/*
 *  Copyright (C) 2011 JiangHongTiao <jjurco.sk_gmail.com>
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package sk.lieskove.jianghongtiao.sitesearch.plugin;

import org.apache.log4j.Logger;
import sk.lieskove.jianghongtiao.multithreaddownloader.request.converter.Converter;
import sk.lieskove.jianghongtiao.multithreaddownloader.request.converter.NoConverter;
import sk.lieskove.jianghongtiao.multithreaddownloader.request.converter.StringEnumConverter;
import sk.lieskove.jianghongtiao.multithreaddownloader.request.converter.TypeConverter;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * Date of create: Sep 13, 2011
 *
 * @author JiangHongTiao <jjurco.sk_gmail.com>
 * @version 2011.0913
 */
public class FoafSkPlugin extends AbstractPlugin{
    
    private final Map<String, Converter> converters = new HashMap<String, Converter>();
    private Logger log = Logger.getLogger(FoafSkPlugin.class);

    public FoafSkPlugin() {
        log.debug("Creating foaf.sk plugin!");
        //page
        String[] utf8 = new String[]{"✓"};
        String[] x = new String[]{"0"};
        String[] y = new String[]{"0"};
        converters.put("p", new TypeConverter("integer"));
        converters.put("q", new NoConverter());
        converters.put("utf8", new StringEnumConverter(utf8));
        converters.put("x", new StringEnumConverter(x));
        converters.put("y", new StringEnumConverter(y));
        
        setConverters(converters);
        String[] obligatory = new String[]{"q"};
        setObligatory(obligatory);
        String[] oneOf = new String[]{};
        setOneOf(oneOf);
        
//        try {
//            //putParam("xml", "0");
//        } catch (ParameterNotAllowedException ex) {
//            log.error("Thrown unexpected exception. This never happened!" + ex);
//        }
        
        setServiceUrl("http://foaf.sk/");
        log.debug("FoafSk plugin created!");
    }

    
}
